package com.ict.fly.controller;

import com.ict.fly.domain.input.LoginInput;
import com.ict.fly.domain.result.Result;
import com.ict.fly.service.LoginService;
import com.ict.fly.service.SeatTypeService;
import com.ict.fly.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

@Controller
@RequestMapping(value = "/index")
public class SeatTypeController {

    @Autowired
    private SeatTypeService seatTypeService;
    @Autowired
    private UserInfoService userInfoService;

    @RequestMapping(value = "/p", method = RequestMethod.POST)
    @ResponseBody
    public Result search(String plane_type) {
        Result result = seatTypeService.searchAll(plane_type);
        return result;
    }
    @RequestMapping(value = "/admin")
    public String admin(Model model) {
        return "webtest/planeInfo";
    }

    @RequestMapping(value = "/plane")
    public String plane(Model model) {
        return "webtest/hello";
    }

    @RequestMapping(value = "/hello2")
    public String plane1(Model model) {

        return "webtest/index";
    }

    @RequestMapping(value = "/planeInfo")
    public String planeInfo(Model model) {
        return "webtest/planeInfo";
    }

    @RequestMapping(value = "/planeOrder")
    public String planeOrder(Model model) {
        return "webtest/planeOrder";
    }

    @RequestMapping(value = "/userInfo_all")
    public String userInfo_all(Model model) {
        return "webtest/userInfo_all";
    }


    @RequestMapping(value = "/userInfo")
    public String userInfo(Model model) { return "webtest/userInfo"; }

    @RequestMapping(value = "/userOrder")
    public String userOrder(Model model) {
        return "webtest/userOrder";
    }


    @RequestMapping("/selAll")
    @ResponseBody
    public Result searchAll() {
        Result result = userInfoService.searchAll();
        return result;
    }


    @RequestMapping(value = "/regist")
    public String regist(Model model) {
        return "webtest/regist";
    }


    @RequestMapping(value = "/user1")
    public String user1(Model model) {
        return "webtest/user1";
    }

    @RequestMapping(value = "/user2")
    public String user2(Model model) {
        return "webtest/user2";
    }

    @RequestMapping(value = "/user3")
    public String user3(Model model) {
        return "webtest/user3";
    }

}
